@using Fluid;
@model Orchard.Markdown.ViewModels.MarkdownPartViewModel
@inject Orchard.Liquid.ILiquidTemplateManager TemplateManager

@{
    string markdown = Model.Markdown;
    var html = Markdig.Markdown.ToHtml(markdown ?? "");

    var templateContext = new TemplateContext();
    templateContext.SetValue("ContentItem", Model.MarkdownPart.ContentItem);

    var rendered = await TemplateManager.RenderAsync(html, templateContext);
}


@markdown.Substring(0, Math.Min(rendered.Length, 200))
